var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("UIBase"),
    s = t("TypeUnlockItem"),
    c = cc._decorator,
    p = c.ccclass,
    l =
        (c.property,
        c.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.allNode = [];
                return e;
            }
            e.prototype.onShowEnd = function () {
                this.updateView();
            };
            e.prototype.onCloseStart = function () {
                for (var t = 0; t < this.allNode.length; t++) QLooperNode.putNode(this.allNode[t]);
                this.allNode.length = 0;
            };
            e.prototype.updateView = function () {
                this.getWearData();
            };
            e.prototype.getWearData = function () {
                for (
                    var t = ["1", "2", "3"],
                        e = CacheDataManager.getCostumeup(),
                        o = CacheDataManager.getCostume(),
                        a = {},
                        i = {},
                        n = {},
                        r = 0;
                    r < t.length;
                    r++
                ) {
                    var s = GameDataValue.getWearEquip(t[r]);
                    if (s) {
                        var c = e[GameDataValue.getEquipData(s).id];
                        if (c) {
                            var p = c.quality,
                                l = o[c.costume_id];
                            this.getValueData(l, p, n, a, i);
                        }
                    }
                }
                if (0 == Object.keys(n).length) {
                    this._reward2.height = 200;
                    this._tipLock.active = !0;
                    this._dlgBg.height = 130;
                } else this._tipLock.active = !1;
                for (var d in n) this.setLockView(n[d], a[d], i[d]);
                this._detail1.$Label.string = "+" + CacheDataManager.getLabAllAdd() + "%";
            };
            e.prototype.setLockView = function (t, e, o) {
                var a = this,
                    i = QLooperNode.getNode(QLooperNode.tag_typeUnlockItem);
                i.parent = this._allLockParent;
                i.zIndex = 20 - e;
                var n = i.getComponent(s.default);
                if (n) {
                    n.bgCom.setColor(e);
                    n.lockNode.active = !0;
                    SpriteView.setQualityBgLineColor(e, n.tip1.node);
                    n.tip1.string = CacheDataManager.getLang(o);
                    n.tip2.string = "+" + t + "%";
                }
                this.scheduleOnce(function () {
                    a._reward2.height = a._allLockParent.height + 100;
                    a._dlgBg.height = a._allLockParent.height + 30;
                });
                this.allNode.push(i);
            };
            e.prototype.getValueData = function (t, e, o, a, i) {
                for (var n = 0; n < 4; n++) {
                    var r = "value" + (n + 1),
                        s = "unlock" + (n + 1),
                        c = "value" + (n + 1) + "_desc";
                    if (t[s] <= e) {
                        var p = t[r].split("_");
                        if (3 == p.length) {
                            var l = p[0] + "_" + p[1];
                            o[l] || (o[l] = 0);
                            if (!a[l]) {
                                a[l] = t[s];
                                i[l] = t[c];
                            }
                            if (t[s] >= a[l]) {
                                a[l] = t[s];
                                i[l] = t[c];
                            }
                            o[l] += parseInt(p[2]);
                        }
                    }
                }
            };
            return n([p], e);
        })(r.default));
o.default = l;
